import React from 'react' 
import {
    Platform,
    Dimensions,
    StyleSheet,
    View,
    Text,
    TouchableOpacity,
    Easing,
    Button,
    DeviceEventEmitter
}from 'react-native'

import JavaMethod from '../JavaMethod';

var _navigation = null

const {width, height} = Dimensions.get('window')

export default class Live extends React.Component {

    static navigationOptions = ({ navigation }) => ({
        headerTitle: '测试111'
    })

    subscription = null;
    
    constructor(props) {
        super(props);
        _navigation = props.navigation;
    }

    componentDidMount() {
       this.listener = DeviceEventEmitter.addListener('SEND_LEADER',this.updateLoginInfoText)
    }

    componentWillUnmount() {
        this.listener.remove();
    }

    updateLoginInfoText(e) {
        alert(JSON.stringify(e))
    }

    clickBack() {
        // _navigation.state.params.callback({name:'denglong'})
        // _navigation.goBack()
        JavaMethod.info('1111', '发几款撒打飞机');
    }

    render(){
        return(
            <View>
                <TouchableOpacity style={{marginTop: 100}} activeOpacity={0.9} onPress={this.clickBack}>
                <Text style={{marginLeft: 100}}>返回</Text>
                </TouchableOpacity>
            </View>
        )
    }
}